import {createRouter, createWebHashHistory} from "vue-router";
// 前端遵循约定大于规定
// 根据目录文件直接获取路由,约定规则非常重要


//定义变量
const routes = [
    {
        path: '/',
        //注:vite打包工具强制要求补全路径文件名称，不能省略后缀名
        //component:按需加载
        //component:()=>import箭头函数格式
        //import引自于路径地址
        component: () => import( '../views/Main.vue' ),
        //children对象
        children: [
            {
                path: '/',
                name: 'home',
                label: '首页',
                icon: 'house',
                component: () => import('@/views/home/index.vue')
            },
            {
                path: '/communicate',
                name: 'communicate',
                label: '即时通讯',
                icon: 'message',
                component: () => import('@/views/message/index.vue')
            },
            {
                path: '/crossBorder',
                name: 'crossBorder',
                label: '跨境大数据',
                icon: 'Connection',
                component: () => import('@/views/mailCrossBorderData/index.vue')
            },
            {
                path: '/personal',
                name: 'personal',
                label: '个人中心',
                icon: 'user',
                component: () => import('@/views/personal/index.vue')
            },
            {
                path: '/regulations',
                name: 'regulations',
                label: '政策法规管理',
                icon: 'document-checked',
                component: () => import('@/views/policy/index.vue')
            },
            {
                path: '/platform',
                name: 'platform',
                label: '大数据管理平台',
                icon: 'data-analysis',
                component: () => import('@/views/platform/index.vue')
            },
            {
                path: '/settings',
                name: 'settings',
                label: '设置',
                icon: 'setting',
                component: () => import('@/views/settings/index.vue')
            },
            {
                path: '/site',
                name: 'site',
                label: '企业及网点管理',
                icon: 'office-building',
                // component: () => import('@/views/site/index.vue'),
                children: [
                    {
                        path: '/site/brand',
                        name: 'brand',
                        label: '企业信息管理',
                        icon: 'School',
                        component: () => import('@/views/site/brand/index.vue')
                    },
                    {
                        path: '/site/spot',
                        name: 'spot',
                        label: '网点信息管理',
                        icon: 'MapLocation',
                        component: () => import('@/views/site/spot/index.vue')
                    }
                ]
            },
            {
                path: '/sms',
                name: 'sms',
                label: '短信群发',
                icon: 'message',
                component: () => import('@/views/sms/index.vue')
            },
            {
                path: '/statistics',
                name: 'statistics',
                label: '统计分析',
                icon: 'PieChart',
                // component: () => import('@/views/statistics/index.vue'),
                children: [
                    {
                        path: '/statistics/aceProject',
                        name: 'aceProject',
                        label: '金银铜牌项目',
                        icon: 'medal',
                        component: () => import('@/views/statistics/aceProject/index.vue')
                    },
                    {
                        path: '/statistics/analysisReport',
                        name: 'analysisReport',
                        label: '数据分析报告',
                        icon: 'DocumentCopy',
                        component: () => import('@/views/statistics/analysisReport/index.vue')
                    },
                    {
                        path: '/statistics/hotSellingItems',
                        name: 'hotSellingItems',
                        label: '热销产品',
                        icon: 'present',
                        component: () => import('@/views/statistics/hotSellingItems/index.vue')
                    },
                    {
                        path: '/statistics/hotSellingRegions',
                        name: 'hotSellingRegions',
                        label: '热销城市',
                        icon: 'location',
                        component: () => import('@/views/statistics/hotSellingRegions/index.vue')
                    },
                    {
                        path: '/statistics/inOrOutTurnover',
                        name: 'inOrOutTurnover',
                        label: '进出港件统计',
                        icon: 'Switch',
                        component: () => import('@/views/statistics/inOrOutTurnover/index.vue')
                    }
                ]
            },
            {
                path: '/supervise',
                name: 'supervise',
                label: '安全预警',
                icon: 'warning',
                // component: () => import('@/views/supervise/index.vue'),
                children: [
                    {
                        path: '/supervise/display',
                        name: 'display',
                        label: '安全预警可视化',
                        icon: 'Lock',
                        component: () => import('@/views/supervise/display/index.vue')
                    },
                    {
                        path: '/supervise/keyPersonnel',
                        name: 'keyPersonnel',
                        label: '重点人员信息库',
                        icon: 'Aim',
                        component: () => import('@/views/supervise/keyPersonnel/index.vue')
                    },
                    {
                        path: '/supervise/warning',
                        name: 'warning',
                        label: '预警管理',
                        icon: 'DocumentDelete',
                        component: () => import('@/views/supervise/warning/index.vue')
                    }
                ]
            },
            {
                path: '/manage',
                name: 'manage',
                label: '系统管理',
                icon: 'EditPen',
                // component: () => import('@/views/manage/index.vue'),
                children: [

                    {
                        path: '/manage/log',
                        name: 'log',
                        label: '日志管理',
                        icon: 'Document',
                        component: () => import('@/views/manage/log/index.vue')
                    },
                    {
                        path: '/manage/roles',
                        name: 'roles',
                        label: '角色管理',
                        icon: 'Place',
                        component: () => import('@/views/manage/roles/index.vue')
                    },
                    {
                        path: '/manage/spot',
                        name: 'menu',
                        label: '菜单管理',
                        icon: 'Grid',
                        component: () => import('@/views/manage/menu/index.vue')
                    },
                    {
                        path: '/manage/user',
                        name: 'user',
                        label: '用户管理',
                        icon: 'Coordinate',
                        component: () => import('@/views/manage/user/index.vue')
                    }
                ]
            },
            {
                path: '/video',
                name: 'video',
                label: '视频管理',
                icon: 'video-camera',
                component: () => import('@/views/video/index.vue')
            },
            {
                path: '/violation',
                name: 'violation',
                label: '违规违法管理',
                icon: 'DocumentCopy',
                // component: () => import('@/views/violation/index.vue'),
                children: [
                    {
                        path: '/violation/eventBack',
                        name: 'eventBack',
                        label: '事件追朔',
                        icon: 'RefreshRight',
                        component: () => import('@/views/violation/eventBack/index.vue')
                    },
                    {
                        path: '/violation/type',
                        name: 'type',
                        label: '违规类型管理',
                        icon: 'CircleClose',
                        component: () => import('@/views/violation/type/index.vue')
                    }
                ]
            },
            {
                path: '/visualization',
                name: 'visualization',
                label: '可视化平台管理',
                icon: 'DataLine',
                component: () => import('@/views/visualization/index.vue')
            },
            {
                path: '/television',
                name: 'television',
                label: '软解电视墙',
                icon: 'Monitor',
                component: () => import('@/views/television/index.vue')
            },
            {
                path: '/weather',
                name: 'weather',
                label: '天气预报',
                icon: 'Sunny',
                component: () => import('@/views/weather/index.vue')
            }
        ]
    }
]
//createRouter是一个方法，{内容}此内容为对象 ，creat是方法就必须要调用，不然声明会报错
const router = createRouter({
    history: createWebHashHistory(),//对象
    routes,
})


//路由导出暴露，导出
export default router